<template>
	<view class="content">
		<view class="topimg">
		 邀请好友
		</view>
		<view class="main">
			<image class="img" @tap="_previewImage(codeImg)" :src="codeImg"></image>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				codeImg: '',
				code: '',
			}
		},
		onLoad() {
			// this.getUserInfo();
			this.getWechatCode();
		},
		methods: {
			_previewImage(image) {
				var imgArr = [];
				imgArr.push(image);
				//预览图片
				uni.previewImage({
					urls: imgArr,
					current: imgArr[0]
				});
			},
			// 获取小程序码
			getWechatCode() {
				this.$http.qrcode().then((res) => {
					console.log(res);
					this.codeImg = res.data;
					// uni.arrayBufferToBase64(arrayBuffer) 将 ArrayBuffer 对象转成 Base64 字符串
				})
			},
			copy(value) {
				uni.setClipboardData({
				    data: value,
				    success: function () {
				      // uni.showToast({title: '复制成功', icon: 'none'});;
				    }
				});
			},
			saveImg() {
				
			},
		}
	}
</script>

<style scoped>
/* .content{ padding: 35px 6% 0 6%; width: 100%; background: url(../../static/img/share.png) left top no-repeat; background-size: 100%;} */
.content{
	
	background: linear-gradient(360deg, #FFC500 0%, #FF5F01 100%);
	box-shadow: 0px 4px 8px 0px #FFAB71;
	padding: 0;
	 width: 100%;
	 max-height: 100%;
	 /* margin-bottom: 100px; */
	  }
.topimg{
	font-size:80upx;
	font-family:hzgb;
	color:rgba(255,255,255,1);
	text-align: center;
	padding: 50upx 0;
}
.topimg .img{ width: 100%; height: 360px;}
.icon{ color: #fff; position: absolute; top: 20px; left: 4%;}
.main{ 
	width:632upx;
	height:1028upx;
	background:rgba(255,255,255,1);
	border-radius:30upx;
	    margin: auto;
		    display: flex;
		    flex-direction: column;
		    align-items: center;
		    justify-content: center;
			border:2upx solid #2B2A29;
}
.main .img{ width: 200px; height: 200px;}
.main .code{padding: 10px 0 0 0; font-size: 21px; color: #242424;}
.main .copy{ padding: 10px 0; font-size: 12px;}
.common-btn{ width: 92%; margin: 30px 4% 0 4%;}

</style>
